/*
 * @(#)WebMvcConfiguration.java 1.0 2019年1月8日上午11:13:48
 *
 * 
 * Copyright (c) , Inc. All rights reserved.
 */
package com.saturn.config.server.setup;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

import com.saturn.config.server.interceptor.LoginRequiredInterceptor;

/**
 * <dl>
 *    <dt><b>Title:</b></dt>
 *    <dd>
 *    	none
 *    </dd>
 *    <dt><b>Description:</b></dt>
 *    <dd>
 *    	<p>none
 *    </dd>
 * </dl>
 *
 * @author tanks
 * @version 1.0, 2019年1月8日
 * @since JdbcConfigServer
 * 
 */

@Configuration
public class WebMvcConfiguration extends WebMvcConfigurationSupport  {
	
	@Autowired
	private LoginRequiredInterceptor loginRequiredInterceptor;
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(loginRequiredInterceptor)
		.addPathPatterns("/**").excludePathPatterns("/static/**","/login","/error","/api/queryAppInfo.htm","/api/queryAppInfo");
	}
	
	 /**
     * 添加静态资源文件，外部可以直接访问地址
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
    	registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
    	super.addResourceHandlers(registry);
    }

}
